package com.lyw.enums;

import java.awt.event.KeyEvent;
import java.util.HashMap;
import java.util.Map;

/**
 * 角色
 */
public enum CharacterEnum {

  // 剑圣
  NAN_GUI_SWORD_SAINT(new int[]{0, 255, 255},
          63,
          new int[]{24, 90},
          "images/characters/swordGod.jpg");

  // 人物颜色
  private int[] color;
  // 人物间隔
  private int interval;
  // 人物宽高
  private int[] roleWidthHeight;
  // 模板位置
  private String picPath;

  public Map<int[], int[]> skill_list;
  public Map<Integer, int[]> skill_arguments;

  CharacterEnum(int[] color, int interval, int[] roleWidthHeight, String picPath) {
    this.color = color;
    this.interval = interval;
    this.roleWidthHeight = roleWidthHeight;
    this.picPath = picPath;
  }

  public int[] getSkill_arguments(int skill_keycode) {
    return skill_arguments.get(skill_keycode);
  }

  public void setSkill_arguments(Map<Integer, int[]> skill_arguments) {
    this.skill_arguments = skill_arguments;
  }

  public int[] getSkill_list(int[] cur_room_position) throws Exception {
    for (int[] ints : skill_list.keySet()) {
      if (ints[0] == cur_room_position[0] && ints[1] == cur_room_position[1]) {
        return skill_list.get(ints);
      }
    }
    throw new Exception("当前获取小地图坐标信息 " + cur_room_position[0] + " 是否有问题！");
  }

  public int[] getRoleWidthHeight() {
    return roleWidthHeight;
  }

  public void setRoleWidthHeight(int[] roleWidthHeight) {
    this.roleWidthHeight = roleWidthHeight;
  }

  public void setSkill_list(Map<int[], int[]> skill_list) {
    this.skill_list = skill_list;
  }

  public String getPicPath() {
    return picPath;
  }

  public void setPicPath(String picPath) {
    this.picPath = picPath;
  }

  public int[] getColor() {
    return color;
  }

  public void setColor(int[] color) {
    this.color = color;
  }

  public int getInterval() {
    return interval;
  }

  public void setInterval(int interval) {
    this.interval = interval;
  }

  /**
   * 加载人物技能释放参数
   */
  public static void load_character_skill() {
    Map<int[], int[]> skill_list = new HashMap<>();
    skill_list.put(new int[]{1, 3}, new int[]{KeyEvent.VK_R, KeyEvent.VK_D, KeyEvent.VK_SPACE});
    // 路线技能
    skill_list.put(new int[]{1, 2}, new int[]{KeyEvent.VK_A, KeyEvent.VK_V, KeyEvent.VK_7, KeyEvent.VK_S});
    skill_list.put(new int[]{2, 2}, new int[]{KeyEvent.VK_W, KeyEvent.VK_V, KeyEvent.VK_7, KeyEvent.VK_S});
    skill_list.put(new int[]{2, 1}, new int[]{KeyEvent.VK_E, KeyEvent.VK_Q, KeyEvent.VK_V, KeyEvent.VK_7, KeyEvent.VK_S});
    skill_list.put(new int[]{2, 0}, new int[]{KeyEvent.VK_Y, KeyEvent.VK_V, KeyEvent.VK_7, KeyEvent.VK_S});
    skill_list.put(new int[]{3, 0}, new int[]{KeyEvent.VK_W, KeyEvent.VK_Q, KeyEvent.VK_V, KeyEvent.VK_7, KeyEvent.VK_S});
    skill_list.put(new int[]{4, 0}, new int[]{KeyEvent.VK_E, KeyEvent.VK_A, KeyEvent.VK_G, KeyEvent.VK_H,
            KeyEvent.VK_W, KeyEvent.VK_Q, KeyEvent.VK_T});

    skill_list.put(new int[]{1, 0}, new int[]{KeyEvent.VK_Q, KeyEvent.VK_V, KeyEvent.VK_7, KeyEvent.VK_S});
    skill_list.put(new int[]{1, 1}, new int[]{KeyEvent.VK_G, KeyEvent.VK_W, KeyEvent.VK_V, KeyEvent.VK_7, KeyEvent.VK_S});
    skill_list.put(new int[]{3, 2}, new int[]{KeyEvent.VK_W, KeyEvent.VK_V, KeyEvent.CTRL_DOWN_MASK});
    skill_list.put(new int[]{3, 1}, new int[]{KeyEvent.VK_A, KeyEvent.VK_Q, KeyEvent.VK_V, KeyEvent.VK_7, KeyEvent.VK_S});

    // 第一个值是距离(999: buff 技能直接释放)
    // 第二个是次数(-1 长期可用)
    // 第三个是是否有方向（0 没有， 1 来回， 2 两个按键）

    // 技能释放参数
    Map<Integer, int[]> skill_arguments = new HashMap<>();
    skill_arguments.put(KeyEvent.VK_Q, new int[]{180, 2, 0});
    skill_arguments.put(KeyEvent.VK_W, new int[]{-50, 2, 1});
    skill_arguments.put(KeyEvent.VK_E, new int[]{-10, 1, 0});
    skill_arguments.put(KeyEvent.VK_R, new int[]{999, 1, 0});
    skill_arguments.put(KeyEvent.VK_V, new int[]{-30, 1, 0});
    skill_arguments.put(KeyEvent.VK_7, new int[]{-30, 1, 0});
    skill_arguments.put(KeyEvent.VK_Y, new int[]{70, 1, 0});
//    skill_arguments.put(KeyEvent.CTRL_DOWN_MASK, new int[]{70, 1, 0});
    skill_arguments.put(KeyEvent.VK_A, new int[]{-10, 1, 0});
    skill_arguments.put(KeyEvent.VK_S, new int[]{-20, 10, 0});
    skill_arguments.put(KeyEvent.VK_D, new int[]{99999, 0, 0});
    skill_arguments.put(KeyEvent.VK_F, new int[]{9999, 0, 0});
    skill_arguments.put(KeyEvent.VK_G, new int[]{-20, 1, 0});
    skill_arguments.put(KeyEvent.VK_H, new int[]{-50, 1, 0});
    skill_arguments.put(KeyEvent.VK_T, new int[]{9999, 0, 0});

    CharacterEnum.NAN_GUI_SWORD_SAINT.setSkill_list(skill_list);
    CharacterEnum.NAN_GUI_SWORD_SAINT.setSkill_arguments(skill_arguments);
  }
}
